home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / share / Dos / VARIOS / pascal / DELPHI.SWG / 0025_How to set a max and min form size.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-02-21  |  1.1 KB  |  56 lines

  1. {
  2. When you want to control how much your users can resize your
  3. form, you can control that by setting the MinMax values.  (If
  4. you use the resize method to limit the size, it will work, but
  5. it won't look quite as good.)
  6.  
  7. Note:  To make it so that the user cannot change the form's
  8. size at all, make the min and max sizes the same values.
  9.  
  10. This is an example of how to declare and use the wm_GetMinMaxInfo
  11. windows message in your applications.
  12. }
  13. unit MinMax;
  14.  
  15. interface
  16.  
  17. uses
  18.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  19.   Forms, Dialogs;
  20.  
  21. type
  22.   TForm1 = class(TForm)
  23.   private
  24.     { Private declarations }
  25.     procedure WMGetMinMaxInfo(var MSG: Tmessage); message WM_GetMinMaxInfo;
  26.   public
  27.     { Public declarations }
  28.   end;
  29.  
  30. var
  31.   Form1: TForm1;
  32.  
  33. implementation
  34.  
  35. {$R *.DFM}
  36.  
  37. procedure TForm1.WMGetMinMaxInfo(var MSG: Tmessage);
  38. Begin
  39.   inherited;
  40.   with PMinMaxInfo(MSG.lparam)^ do
  41.   begin
  42.     with ptMinTrackSize do
  43.     begin
  44.       X := 300;
  45.       Y := 150;
  46.     end;
  47.     with ptMaxTrackSize do
  48.     begin
  49.       X := 350;
  50.       Y := 250;
  51.     end;
  52.   end;
  53. end;
  54.  
  55. end.
  56.